#ifndef MYSQLCONNECTION_H
#define MYSQLCONNECTION_H
#include <QtSql>
#include "qsqldatabase.h"
#include "qsqlquerymodel.h"

class MySqlConnection
{
public:
    MySqlConnection();
    virtual ~MySqlConnection();
    QSqlDatabase DB;

    bool connected;
    bool connect(QString uid, QString pwd);
    static bool connectiontest();
    void Open();
    void Close();
    QSqlQuery *query;
    QSqlQuery exec(QString query);
    QSqlQueryModel* getTable(QString table);
    QSqlQueryModel* DangNhap(QString user);
    bool execQuery();
    QStringList AutoComplete(QString table,QString fieldName);
    QString *test;
    bool KiemTraTrung(QString TenBang,QString TenField,QString GiaTri);
    int giatTriQuyDinh(int maQuyDinh,bool &b);
    QString sinhMa(QString tenBang,QString tenFied);

};

#endif // MYSQLCONNECTION_H
